/*
 * Copyright (c) 2017-2021, Lindenis Tech. Ltd.
 * All rights reserved.
 *
 * File:
 *
 * Description:
 *
 * Author:
 *      xiaoshujun@lindeni.com
 *
 * Create Date:
 *      2021/02/18
 *
 * History:
 *
 */

#ifndef __LIND_AUDIO_PROCESS_MODULE_H__
#define __LIND_AUDIO_PROCESS_MODULE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "osal_types.h"

#define APM_DEFAULT_BITS          16
#define APM_DEFAULT_CHANNELS      1
#define APM_DEFAULT_SAMPLE_RATE   16000
#define APM_DEFAULT_PERIOD_SIZE   160
#define APM_DEFAULT_SIZE_BYTES    (APM_DEFAULT_PERIOD_SIZE * APM_DEFAULT_CHANNELS * APM_DEFAULT_BITS >> 3)

typedef enum _apm_mode_e{
    APM_Conservative = 0,
    APM_Moderate,
    APM_Aggressive
} apm_mode_e;

typedef struct _lindapm_config_t
{
    int32_t     bits;                   // MUST 16bits
    int32_t     channels;               // MUST MONO
    int32_t     sample_rate;            // 8K, 16K, 32K
    int32_t     period_size;            // 80, 160

    int8_t      enable_ns;
    apm_mode_e  ns_mode;

    int8_t      enable_aec;
    apm_mode_e  aec_mode;
    int8_t      aec_delay;
} lindapm_config_t;

_handle_t lindapm_create();
void lindapm_destroy(_handle_t h_apm);
int  lindapm_init(_handle_t h_apm, lindapm_config_t * p_config);
int  lindapm_deinit(_handle_t h_apm);
int  lindapm_write_farend(_handle_t h_apm, uint8_t * pcm_far, int size);
int  lindapm_process(_handle_t h_apm, uint8_t * pcm_near, int size, uint8_t * pcm_out);

#ifdef __cplusplus
}
#endif

#endif  // __LIND_AUDIO_PROCESS_MODULE_H__


